import request from '@/config/axios'
import type { Dayjs } from 'dayjs';

/** 教师用户信息 */
export interface Teacher {
          id: number; // 主键
          userId?: number; // 微信用户关联
          teacherName: string; // 老师姓名
          teacherAge: number; // 年龄
          teacherSex: boolean; // 老师性别（0男 1女 2未知）
          teacherIntro: string; // 教师简介
  }

// 教师用户 API
export const TeacherApi = {
  // 查询教师用户分页
  getTeacherPage: async (params: any) => {
    return await request.get({ url: `/train/teacher/page`, params })
  },
  // 查询全部教师用户
  getTeacherList: async (params: any) => {
    return await request.get({ url: `/train/teacher/list`, params })
  },
  // 查询教师用户详情
  getTeacher: async (id: number) => {
    return await request.get({ url: `/train/teacher/get?id=` + id })
  },

  // 新增教师用户
  createTeacher: async (data: Teacher) => {
    return await request.post({ url: `/train/teacher/create`, data })
  },

  // 修改教师用户
  updateTeacher: async (data: Teacher) => {
    return await request.put({ url: `/train/teacher/update`, data })
  },

  // 删除教师用户
  deleteTeacher: async (id: number) => {
    return await request.delete({ url: `/train/teacher/delete?id=` + id })
  },

  /** 批量删除教师用户 */
  deleteTeacherList: async (ids: number[]) => {
    return await request.delete({ url: `/train/teacher/delete-list?ids=${ids.join(',')}` })
  },

  // 导出教师用户 Excel
  exportTeacher: async (params) => {
    return await request.download({ url: `/train/teacher/export-excel`, params })
  }
}
